<?php

/*
 * Copyright 2014 gg.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

namespace Wechat\Model;
use Think\Model;
/**
 * Description of StudentModel
 *
 * @author gg
 */
class StudentModel extends Model {
    protected $insertFields = array('stunumber','passwd','publickey','status');
    protected $updateFields = array('stunumber','passwd','publickey','status');
    
    public function chkPublicKey($key){
        $result = $this->where(array('publickey'=>$key))->find();
        return $result;
    }
    
    public function unBind($key){
        echo $key;
        $tmp = $this->chkPublicKey("".$key);
        print_r($tmp);
        $this->delete($tmp['id']);
    }
}
